About 519 letters

About 3 minutes

#hex

Description: Convert an integer to a hexadecimal string prefixed with 0x.

def hex(x: int):
    '''
    Convert an integer to a hexadecimal string prefixed with `0x`

    :param x: An integer
    :return: The hexadecimal string representation of x
    '''

Example:

print(hex(0))
print(hex(10))
print(hex(1024))

>>> Establishing WebAssembly Runtime.

>>> Standby.

Powered by Shift.

Updated: 6/9/2025

Author: PlanC

Created: 6/9/2025